export default function createElement(type, props, ...children) {
    const childrenElements = [].concat(...children).reduce((prev, current) => {
        if (current !== false && current !== true && current !== null) {
            if (current instanceof Object) {
                prev.push(current)
            } else {
                prev.push(createElement('text', { textContent: current}))
            }
        }
        return prev
    }, [])
    
    return {
        type,
        props: Object.assign({children: childrenElements}, props), // props中应该包含children属性存储所有的子元素节点集合
        children: childrenElements
    }

}